<?php
/**
 * Fang_Service_Intro
 * 
 * 作者:  姚刚 (yaogang@the9sense.com)
 * 创建时间: 2011-03-14 21:01:50
 * 修改记录: 
 * 
 * $Id: Intro.php 18 2011-04-17 12:50:07Z coosuu $
 */

class Fang_Service_Intro {

    /**
     * get
     * 获取一行数据 
     * 
     * @return void
     */
    public function get($fields = array()) {

        try {
            return Fang_DAO_Intro::getRow($fields);
        } catch (Exception $e) {
            Logger::error($e);
            throw new Service_Exception($e);
        }

    }

    /**
     * save 
     * 
     * @param  mixed $telphone 
     * @param  mixed $address 
     * @param  mixed $shopName 
     * @param  mixed $indexPic 
     * @return void
     */
    public function save($telphone = null, $address = null, $shopName = null, $indexPic = null, $contactId = 0, $aboutIds = null, $newsCid = 0) {

        $data = array('i_telphone' => $telphone,
                      'i_address' => $address,
                      'i_shopname' => $shopName,
                      'i_indexpic' => $indexPic,
                      'i_contact_id' => $contactId,
                      'i_about_ids' => $aboutIds,
                      'i_news_cid' => $newsCid);
        $data = array_filter($data);
        if (!$data) {
            return true;
        }

        try {
            return Fang_DAO_Intro::save($data);
        } catch (Exception $e) {
            Logger::error($e);
            throw new Service_Exception($e);
        }
    }
}
